﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Users.aspx.cs" Inherits="WebApplication1.Users" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        .style1
        {
            width: 225px;
        }
        #form1
        {
            height: 1px;
        }
    </style>
</head>
<body bgcolor="orange">
    <form id="form1" runat="server">
    <div>
    
        <asp:Label ID="Label1" runat="server" Font-Size="X-Large" ForeColor="Blue" 
            Text="Пользователи системы:"></asp:Label>
        <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
            AutoGenerateColumns="False" BackColor="Yellow" DataKeyNames="Id" 
            DataSourceID="SqlDataSource1" Font-Size="Large">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                    ReadOnly="True" SortExpression="Id" />
                <asp:BoundField DataField="Password" HeaderText="Password" 
                    SortExpression="Password" />
                <asp:BoundField DataField="Role" HeaderText="Role" SortExpression="Role" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="Surname" HeaderText="Surname" 
                    SortExpression="Surname" />
                <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:BoundField DataField="Login" HeaderText="Login" SortExpression="Login" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TestConnectionString %>" 
            DeleteCommand="DELETE FROM [User1] WHERE [Id] = @Id" 
            InsertCommand="INSERT INTO [User1] ([Password], [Role], [Name], [Surname], [Phone], [Email], [Login]) VALUES (@Password, @Role, @Name, @Surname, @Phone, @Email, @Login)" 
            SelectCommand="SELECT * FROM [User1]" 
            UpdateCommand="UPDATE [User1] SET [Password] = @Password, [Role] = @Role, [Name] = @Name, [Surname] = @Surname, [Phone] = @Phone, [Email] = @Email, [Login] = @Login WHERE [Id] = @Id">
            <DeleteParameters>
                <asp:Parameter Name="Id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="Role" Type="Int32" />
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Surname" Type="String" />
                <asp:Parameter Name="Phone" Type="Int32" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Login" Type="String" />
                <asp:Parameter Name="Id" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="Role" Type="Int32" />
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Surname" Type="String" />
                <asp:Parameter Name="Phone" Type="Int32" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Login" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
        <asp:HyperLink ID="HyperLink2" runat="server" Font-Size="Large" 
            NavigateUrl="~/Newuser.aspx">Добавить нового&gt;&gt;</asp:HyperLink>
        <br />
        <br />
        <br />
        <br />
    
    </div>
    <asp:HyperLink ID="HyperLink1" runat="server" Font-Size="Large" 
        NavigateUrl="~/Main.aspx">&lt;&lt;На главную</asp:HyperLink>
        <img src="13.gif" style="height: 87px; width: 111px" align="right">
    </form>
</body>
</html>
